﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;

namespace ProjectNocturnalFool
{
    class BackgroundControl : UserControl
    {
        public Color bgColor = Color.White;


        /// <summary>
        /// Loads Content of button
        /// </summary>
        public override void LoadContent()
        {
            base.LoadContent();

            List<Texture2D> texList = new List<Texture2D>();
            texList.Add(TacticsGame.Instance.Content.Load<Texture2D>(Constants.TextureParticleLeaf));
            _bgTexture = TacticsGame.Instance.Content.Load<Texture2D>(Constants.TextureBackgroundTitle);
            
            width = VirtualScreen.Instance.VirtualWidth;
            height = VirtualScreen.Instance.VirtualHeight;

            depth = ControlDepth.Background;
        }

        /// <summary>
        /// Updates logic based on mouse
        /// </summary>
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

        }

        /// <summary>
        /// Draws button based on location
        /// </summary>
        /// <param name="gameTime">gameTime since last draw</param>
        public override void Draw(GameTime gameTime)
        {
            TacticsGame.Instance.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, RasterizerState.CullNone);

            Rectangle targetRect = new Rectangle(x, y, width, height);

            TacticsGame.Instance.spriteBatch.Draw(_bgTexture,
                                      targetRect,
                                      null,
                                      bgColor,
                                      0,
                                      Vector2.Zero,
                                      SpriteEffects.None,
                                      0);

            TacticsGame.Instance.spriteBatch.End();

           // engine.Draw();
        }


    }
}
